package playback;

import javax.sound.sampled.AudioFormat;

public class ClipManager {
	public static AudioFormat MASTER_FORMAT;
	
	public static UClip addSilenceGap(AudioFormat af, int scum, byte[] ba, byte[] bb) {
		byte[] tot = new byte[ba.length + bb.length + scum];
		for (int i = 0; i < ba.length; i++) {
			tot[i] = ba[i];
		}
		for (int i = 0; i < scum; i ++) {
			tot[ba.length + i] = (byte) 0x80;
		}
		return new UClip(af, tot);
	}
	
	public static byte[][] split(byte[] ar, int ind) {
		byte[] beginning = new byte[ind];
		for (int i = 0; i < ind; i++) {
			beginning[i] = ar[i];
		}
		byte[] end = new byte[ar.length-ind];
		System.out.println(ar.length + " " + end.length);
		for (int i = ind; i < ar.length; i++) {
			end[i-ind] = ar[i];
		}
		return new byte[][]{beginning, end};
	}

}
